<form onsubmit="return false" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">

    <div class="layui-card-body">

        <div class="color-blue padding-left-40 padding-bottom-20">
            使用第三方授权时，需要单独搭建 SERVICE 服务并将域名配置到 WECHAT 文件，二者需要使用 Yar 或 Soap 通信！
        </div>

        <!--{if !empty($wechat)}-->
        <div class="layui-form-item">
            <label class="layui-form-label">QRCode<br><span class="nowrap color-desc">公众号二维码</span></label>
            <div class="layui-input-block">
                <div class="pull-left notselect"><img data-tips-image src="{$wechat.qrcode_url|local_image}" style="width:100px;margin-left:-7px"></div>
                <div class="pull-left padding-left-10">
                    <p class="nowrap">微信昵称：{$wechat.nick_name|default=''}</p>
                    <p class="nowrap">微信类型：{if $wechat.service_type eq 2}服务号{elseif $wechat.service_type eq 3}小程序{else}订阅号{/if} / {$wechat.verify_type_info == -1 ? '未认证' : '<span class="color-green">已认证</span>'}</p>
                    <p class="nowrap">注册公司：{$wechat.principal_name}</p>
                    <p class="nowrap">授权绑定：{$wechat.create_at|format_datetime}</p>
                </div>
            </div>
        </div>
        <!--{/if}-->

        <div class="layui-form-item">
            <label class="layui-form-label">Authorize<br><span class="nowrap color-desc">公众号授权绑定</span></label>
            <div class="layui-input-block">
                <button type="button" data-href="{$authurl|default=''}" class="layui-btn layui-btn-primary">重新绑定公众号</button>
                <p class="help-block">点击连接将跳转到微信第三方平台进行公众号授权。</p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">AppId<br><span class="nowrap color-desc">公众号APPID</span></label>
            <div class="layui-input-block">
                <input name="wechat_thr_appid" placeholder="请输入以wx开头的18位公众号APPID（必填）" pattern="^wx[0-9a-z]{16}$" maxlength="18" required value="{:sysconf('wechat_thr_appid')}" class="layui-input">
                <p class="help-block">众号 appid 通过微信第三方授权自动获取. 若没有值请进行微信第三方授权。</p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">AppKey<br><span class="nowrap color-desc">第三方服务密钥</span></label>
            <div class="layui-input-block">
                <input name="wechat_thr_appkey" required placeholder="请输入32位公众号AppSecret（必填）" value="{:sysconf('wechat_thr_appkey')}" maxlength="32" pattern="^[0-9a-z]{32}$" class="layui-input">
                <p class="help-block">公众号服务平台接口密钥, 通过微信第三方授权自动获取, 若没有值请进行微信第三方授权。</p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">AppPushUri<br><span class="nowrap color-desc">第三方推送接口</span></label>
            <div class="layui-input-block">
                <div class="relative margin-top-5">
                    <input name="wechat_thr_appurl" value="消息推送地址：{$thrNotify}" readonly class="layui-input layui-bg-gray border-0">
                    <a data-copy="{$thrNotify}" class="absolute layui-btn layui-bg-gray" style="top:0;right:0;background:none!important"><i class="fa fa-copy"></i></a>
                </div>
                <p class="help-block">公众号服务平台接口通知URL, 公众号消息接收与回复等。</p>
            </div>
        </div>

        <div class="hr-line-dashed"></div>
        <input type="hidden" name="wechat_type" value="thr">

        <div class="layui-form-item text-center">
            <button class="layui-btn" type="submit">保存配置</button>
        </div>

    </div>

</form>